using System;
using System.Data;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using C1.Win.C1TrueDBGrid;
using PCSComSale.Order.BO;
using PCSComSale.Order.DS;
using PCSComUtils.Common;
using PCSComUtils.Common.BO;
using PCSComUtils.PCSExc;
using PCSUtils.Log;
using PCSUtils.Utils;

namespace PCSSale.Order
{
	/// <summary>
	/// Summary description for CustomerAndItemReference.
	/// </summary>
	public class CustomerAndItemReference : System.Windows.Forms.Form
	{
		private System.Windows.Forms.Button btnClose;
		private System.Windows.Forms.Button btnDelete;
		private System.Windows.Forms.Button btnHelp;
		private System.Windows.Forms.Button btnSave;
		private C1.Win.C1TrueDBGrid.C1TrueDBGrid dgrdData;
		private System.Windows.Forms.Button btnCustomerSearch;
		private System.Windows.Forms.Label lblCustomerName;
		private System.Windows.Forms.Label lblCustomer;
		private System.Windows.Forms.TextBox txtCustomerName;
		private System.Windows.Forms.Button btnCustomerNameSearch;
		private System.Windows.Forms.Label lblCCN;
		private C1.Win.C1List.C1Combo cboCCN;
		/// <summary>
		/// Required designer variable.
		/// </summary>
		private System.ComponentModel.Container components = null;
		private const string THIS = "PCSSale.Order.CustomerAndItemReference";
		private const string V_VENDORCUSTOMER = "V_VendorCustomer";
		private const string CUSTOMER_FLD = "Customer";
		private bool blnHasError = false;
		private System.Windows.Forms.TextBox txtCustomer;
		private DataTable dtbGridLayOut = new DataTable();
		private CustomerAndItemReferenceBO boCustomerAndItem = new CustomerAndItemReferenceBO();
		private SO_CustomerItemRefMasterVO voCustomMaster = new SO_CustomerItemRefMasterVO();
		private System.Windows.Forms.TextBox txtCurrency;
		private System.Windows.Forms.Label lblCurrency;
		private DataSet dstData = new DataSet();

		public CustomerAndItemReference()
		{
			//
			// Required for Windows Form Designer support
			//
			InitializeComponent();

			//
			// TODO: Add any constructor code after InitializeComponent call
			//
		}

		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if(components != null)
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}

		#region Windows Form Designer generated code
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{
			System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(CustomerAndItemReference));
			this.btnClose = new System.Windows.Forms.Button();
			this.btnDelete = new System.Windows.Forms.Button();
			this.btnHelp = new System.Windows.Forms.Button();
			this.btnSave = new System.Windows.Forms.Button();
			this.cboCCN = new C1.Win.C1List.C1Combo();
			this.btnCustomerSearch = new System.Windows.Forms.Button();
			this.lblCCN = new System.Windows.Forms.Label();
			this.btnCustomerNameSearch = new System.Windows.Forms.Button();
			this.txtCustomerName = new System.Windows.Forms.TextBox();
			this.txtCustomer = new System.Windows.Forms.TextBox();
			this.lblCustomerName = new System.Windows.Forms.Label();
			this.lblCustomer = new System.Windows.Forms.Label();
			this.dgrdData = new C1.Win.C1TrueDBGrid.C1TrueDBGrid();
			this.txtCurrency = new System.Windows.Forms.TextBox();
			this.lblCurrency = new System.Windows.Forms.Label();
			((System.ComponentModel.ISupportInitialize)(this.cboCCN)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.dgrdData)).BeginInit();
			this.SuspendLayout();
			// 
			// btnClose
			// 
			this.btnClose.AccessibleDescription = resources.GetString("btnClose.AccessibleDescription");
			this.btnClose.AccessibleName = resources.GetString("btnClose.AccessibleName");
			this.btnClose.Anchor = ((System.Windows.Forms.AnchorStyles)(resources.GetObject("btnClose.Anchor")));
			this.btnClose.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("btnClose.BackgroundImage")));
			this.btnClose.DialogResult = System.Windows.Forms.DialogResult.Cancel;
			this.btnClose.Dock = ((System.Windows.Forms.DockStyle)(resources.GetObject("btnClose.Dock")));
			this.btnClose.Enabled = ((bool)(resources.GetObject("btnClose.Enabled")));
			this.btnClose.FlatStyle = ((System.Windows.Forms.FlatStyle)(resources.GetObject("btnClose.FlatStyle")));
			this.btnClose.Font = ((System.Drawing.Font)(resources.GetObject("btnClose.Font")));
			this.btnClose.Image = ((System.Drawing.Image)(resources.GetObject("btnClose.Image")));
			this.btnClose.ImageAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("btnClose.ImageAlign")));
			this.btnClose.ImageIndex = ((int)(resources.GetObject("btnClose.ImageIndex")));
			this.btnClose.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("btnClose.ImeMode")));
			this.btnClose.Location = ((System.Drawing.Point)(resources.GetObject("btnClose.Location")));
			this.btnClose.Name = "btnClose";
			this.btnClose.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("btnClose.RightToLeft")));
			this.btnClose.Size = ((System.Drawing.Size)(resources.GetObject("btnClose.Size")));
			this.btnClose.TabIndex = ((int)(resources.GetObject("btnClose.TabIndex")));
			this.btnClose.Text = resources.GetString("btnClose.Text");
			this.btnClose.TextAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("btnClose.TextAlign")));
			this.btnClose.Visible = ((bool)(resources.GetObject("btnClose.Visible")));
			this.btnClose.Click += new System.EventHandler(this.btnClose_Click);
			// 
			// btnDelete
			// 
			this.btnDelete.AccessibleDescription = resources.GetString("btnDelete.AccessibleDescription");
			this.btnDelete.AccessibleName = resources.GetString("btnDelete.AccessibleName");
			this.btnDelete.Anchor = ((System.Windows.Forms.AnchorStyles)(resources.GetObject("btnDelete.Anchor")));
			this.btnDelete.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("btnDelete.BackgroundImage")));
			this.btnDelete.Dock = ((System.Windows.Forms.DockStyle)(resources.GetObject("btnDelete.Dock")));
			this.btnDelete.Enabled = ((bool)(resources.GetObject("btnDelete.Enabled")));
			this.btnDelete.FlatStyle = ((System.Windows.Forms.FlatStyle)(resources.GetObject("btnDelete.FlatStyle")));
			this.btnDelete.Font = ((System.Drawing.Font)(resources.GetObject("btnDelete.Font")));
			this.btnDelete.Image = ((System.Drawing.Image)(resources.GetObject("btnDelete.Image")));
			this.btnDelete.ImageAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("btnDelete.ImageAlign")));
			this.btnDelete.ImageIndex = ((int)(resources.GetObject("btnDelete.ImageIndex")));
			this.btnDelete.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("btnDelete.ImeMode")));
			this.btnDelete.Location = ((System.Drawing.Point)(resources.GetObject("btnDelete.Location")));
			this.btnDelete.Name = "btnDelete";
			this.btnDelete.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("btnDelete.RightToLeft")));
			this.btnDelete.Size = ((System.Drawing.Size)(resources.GetObject("btnDelete.Size")));
			this.btnDelete.TabIndex = ((int)(resources.GetObject("btnDelete.TabIndex")));
			this.btnDelete.Text = resources.GetString("btnDelete.Text");
			this.btnDelete.TextAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("btnDelete.TextAlign")));
			this.btnDelete.Visible = ((bool)(resources.GetObject("btnDelete.Visible")));
			this.btnDelete.Click += new System.EventHandler(this.btnDelete_Click);
			// 
			// btnHelp
			// 
			this.btnHelp.AccessibleDescription = resources.GetString("btnHelp.AccessibleDescription");
			this.btnHelp.AccessibleName = resources.GetString("btnHelp.AccessibleName");
			this.btnHelp.Anchor = ((System.Windows.Forms.AnchorStyles)(resources.GetObject("btnHelp.Anchor")));
			this.btnHelp.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("btnHelp.BackgroundImage")));
			this.btnHelp.Dock = ((System.Windows.Forms.DockStyle)(resources.GetObject("btnHelp.Dock")));
			this.btnHelp.Enabled = ((bool)(resources.GetObject("btnHelp.Enabled")));
			this.btnHelp.FlatStyle = ((System.Windows.Forms.FlatStyle)(resources.GetObject("btnHelp.FlatStyle")));
			this.btnHelp.Font = ((System.Drawing.Font)(resources.GetObject("btnHelp.Font")));
			this.btnHelp.Image = ((System.Drawing.Image)(resources.GetObject("btnHelp.Image")));
			this.btnHelp.ImageAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("btnHelp.ImageAlign")));
			this.btnHelp.ImageIndex = ((int)(resources.GetObject("btnHelp.ImageIndex")));
			this.btnHelp.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("btnHelp.ImeMode")));
			this.btnHelp.Location = ((System.Drawing.Point)(resources.GetObject("btnHelp.Location")));
			this.btnHelp.Name = "btnHelp";
			this.btnHelp.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("btnHelp.RightToLeft")));
			this.btnHelp.Size = ((System.Drawing.Size)(resources.GetObject("btnHelp.Size")));
			this.btnHelp.TabIndex = ((int)(resources.GetObject("btnHelp.TabIndex")));
			this.btnHelp.Text = resources.GetString("btnHelp.Text");
			this.btnHelp.TextAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("btnHelp.TextAlign")));
			this.btnHelp.Visible = ((bool)(resources.GetObject("btnHelp.Visible")));
			// 
			// btnSave
			// 
			this.btnSave.AccessibleDescription = resources.GetString("btnSave.AccessibleDescription");
			this.btnSave.AccessibleName = resources.GetString("btnSave.AccessibleName");
			this.btnSave.Anchor = ((System.Windows.Forms.AnchorStyles)(resources.GetObject("btnSave.Anchor")));
			this.btnSave.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("btnSave.BackgroundImage")));
			this.btnSave.Dock = ((System.Windows.Forms.DockStyle)(resources.GetObject("btnSave.Dock")));
			this.btnSave.Enabled = ((bool)(resources.GetObject("btnSave.Enabled")));
			this.btnSave.FlatStyle = ((System.Windows.Forms.FlatStyle)(resources.GetObject("btnSave.FlatStyle")));
			this.btnSave.Font = ((System.Drawing.Font)(resources.GetObject("btnSave.Font")));
			this.btnSave.Image = ((System.Drawing.Image)(resources.GetObject("btnSave.Image")));
			this.btnSave.ImageAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("btnSave.ImageAlign")));
			this.btnSave.ImageIndex = ((int)(resources.GetObject("btnSave.ImageIndex")));
			this.btnSave.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("btnSave.ImeMode")));
			this.btnSave.Location = ((System.Drawing.Point)(resources.GetObject("btnSave.Location")));
			this.btnSave.Name = "btnSave";
			this.btnSave.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("btnSave.RightToLeft")));
			this.btnSave.Size = ((System.Drawing.Size)(resources.GetObject("btnSave.Size")));
			this.btnSave.TabIndex = ((int)(resources.GetObject("btnSave.TabIndex")));
			this.btnSave.Text = resources.GetString("btnSave.Text");
			this.btnSave.TextAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("btnSave.TextAlign")));
			this.btnSave.Visible = ((bool)(resources.GetObject("btnSave.Visible")));
			this.btnSave.Click += new System.EventHandler(this.btnSave_Click);
			// 
			// cboCCN
			// 
			this.cboCCN.AccessibleDescription = resources.GetString("cboCCN.AccessibleDescription");
			this.cboCCN.AccessibleName = resources.GetString("cboCCN.AccessibleName");
			this.cboCCN.AddItemSeparator = ';';
			this.cboCCN.AllowRowSizing = C1.Win.C1List.RowSizingEnum.AllRows;
			this.cboCCN.Anchor = ((System.Windows.Forms.AnchorStyles)(resources.GetObject("cboCCN.Anchor")));
			this.cboCCN.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("cboCCN.BackgroundImage")));
			this.cboCCN.Caption = "";
			this.cboCCN.CaptionHeight = 17;
			this.cboCCN.CharacterCasing = System.Windows.Forms.CharacterCasing.Normal;
			this.cboCCN.ColumnCaptionHeight = 17;
			this.cboCCN.ColumnFooterHeight = 17;
			this.cboCCN.ComboStyle = C1.Win.C1List.ComboStyleEnum.DropdownList;
			this.cboCCN.ContentHeight = 15;
			this.cboCCN.DeadAreaBackColor = System.Drawing.Color.Empty;
			this.cboCCN.Dock = ((System.Windows.Forms.DockStyle)(resources.GetObject("cboCCN.Dock")));
			this.cboCCN.EditorBackColor = System.Drawing.SystemColors.Window;
			this.cboCCN.EditorFont = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.cboCCN.EditorForeColor = System.Drawing.SystemColors.WindowText;
			this.cboCCN.EditorHeight = 15;
			this.cboCCN.Enabled = ((bool)(resources.GetObject("cboCCN.Enabled")));
			this.cboCCN.FlatStyle = C1.Win.C1List.FlatModeEnum.System;
			this.cboCCN.Font = ((System.Drawing.Font)(resources.GetObject("cboCCN.Font")));
			this.cboCCN.GapHeight = 2;
			this.cboCCN.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("cboCCN.ImeMode")));
			this.cboCCN.ItemHeight = 15;
			this.cboCCN.Location = ((System.Drawing.Point)(resources.GetObject("cboCCN.Location")));
			this.cboCCN.MatchEntryTimeout = ((long)(2000));
			this.cboCCN.MaxDropDownItems = ((short)(5));
			this.cboCCN.MaxLength = 32767;
			this.cboCCN.MouseCursor = System.Windows.Forms.Cursors.Default;
			this.cboCCN.Name = "cboCCN";
			this.cboCCN.PartialRightColumn = false;
			this.cboCCN.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("cboCCN.RightToLeft")));
			this.cboCCN.RowDivider.Color = System.Drawing.Color.DarkGray;
			this.cboCCN.RowDivider.Style = C1.Win.C1List.LineStyleEnum.None;
			this.cboCCN.RowSubDividerColor = System.Drawing.Color.DarkGray;
			this.cboCCN.Size = ((System.Drawing.Size)(resources.GetObject("cboCCN.Size")));
			this.cboCCN.TabIndex = ((int)(resources.GetObject("cboCCN.TabIndex")));
			this.cboCCN.Text = resources.GetString("cboCCN.Text");
			this.cboCCN.Visible = ((bool)(resources.GetObject("cboCCN.Visible")));
			this.cboCCN.PropBag = "<?xml version=\"1.0\"?><Blob><Styles type=\"C1.Win.C1List.Design.ContextWrapper\"><Da" +
				"ta>Group{BackColor:ControlDark;Border:None,,0, 0, 0, 0;AlignVert:Center;}Style2{" +
				"}Style5{}Style4{}Style7{}Style6{}EvenRow{BackColor:Aqua;}Selected{ForeColor:High" +
				"lightText;BackColor:Highlight;}Style3{}Inactive{ForeColor:InactiveCaptionText;Ba" +
				"ckColor:InactiveCaption;}Footer{}Caption{AlignHorz:Center;}Normal{BackColor:Wind" +
				"ow;}HighlightRow{ForeColor:HighlightText;BackColor:Highlight;}Style9{AlignHorz:N" +
				"ear;}OddRow{}RecordSelector{AlignImage:Center;}Heading{Wrap:True;AlignVert:Cente" +
				"r;Border:Raised,,1, 1, 1, 1;ForeColor:ControlText;BackColor:Control;}Style8{}Sty" +
				"le10{}Style11{}Style1{}</Data></Styles><Splits><C1.Win.C1List.ListBoxView AllowC" +
				"olSelect=\"False\" Name=\"\" CaptionHeight=\"17\" ColumnCaptionHeight=\"17\" ColumnFoote" +
				"rHeight=\"17\" VerticalScrollGroup=\"1\" HorizontalScrollGroup=\"1\"><ClientRect>0, 0," +
				" 118, 158</ClientRect><VScrollBar><Width>16</Width></VScrollBar><HScrollBar><Hei" +
				"ght>16</Height></HScrollBar><CaptionStyle parent=\"Style2\" me=\"Style9\" /><EvenRow" +
				"Style parent=\"EvenRow\" me=\"Style7\" /><FooterStyle parent=\"Footer\" me=\"Style3\" />" +
				"<GroupStyle parent=\"Group\" me=\"Style11\" /><HeadingStyle parent=\"Heading\" me=\"Sty" +
				"le2\" /><HighLightRowStyle parent=\"HighlightRow\" me=\"Style6\" /><InactiveStyle par" +
				"ent=\"Inactive\" me=\"Style4\" /><OddRowStyle parent=\"OddRow\" me=\"Style8\" /><RecordS" +
				"electorStyle parent=\"RecordSelector\" me=\"Style10\" /><SelectedStyle parent=\"Selec" +
				"ted\" me=\"Style5\" /><Style parent=\"Normal\" me=\"Style1\" /></C1.Win.C1List.ListBoxV" +
				"iew></Splits><NamedStyles><Style parent=\"\" me=\"Normal\" /><Style parent=\"Normal\" " +
				"me=\"Heading\" /><Style parent=\"Heading\" me=\"Footer\" /><Style parent=\"Heading\" me=" +
				"\"Caption\" /><Style parent=\"Heading\" me=\"Inactive\" /><Style parent=\"Normal\" me=\"S" +
				"elected\" /><Style parent=\"Normal\" me=\"HighlightRow\" /><Style parent=\"Normal\" me=" +
				"\"EvenRow\" /><Style parent=\"Normal\" me=\"OddRow\" /><Style parent=\"Heading\" me=\"Rec" +
				"ordSelector\" /><Style parent=\"Caption\" me=\"Group\" /></NamedStyles><vertSplits>1<" +
				"/vertSplits><horzSplits>1</horzSplits><Layout>Modified</Layout><DefaultRecSelWid" +
				"th>17</DefaultRecSelWidth></Blob>";
			// 
			// btnCustomerSearch
			// 
			this.btnCustomerSearch.AccessibleDescription = resources.GetString("btnCustomerSearch.AccessibleDescription");
			this.btnCustomerSearch.AccessibleName = resources.GetString("btnCustomerSearch.AccessibleName");
			this.btnCustomerSearch.Anchor = ((System.Windows.Forms.AnchorStyles)(resources.GetObject("btnCustomerSearch.Anchor")));
			this.btnCustomerSearch.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("btnCustomerSearch.BackgroundImage")));
			this.btnCustomerSearch.Dock = ((System.Windows.Forms.DockStyle)(resources.GetObject("btnCustomerSearch.Dock")));
			this.btnCustomerSearch.Enabled = ((bool)(resources.GetObject("btnCustomerSearch.Enabled")));
			this.btnCustomerSearch.FlatStyle = ((System.Windows.Forms.FlatStyle)(resources.GetObject("btnCustomerSearch.FlatStyle")));
			this.btnCustomerSearch.Font = ((System.Drawing.Font)(resources.GetObject("btnCustomerSearch.Font")));
			this.btnCustomerSearch.Image = ((System.Drawing.Image)(resources.GetObject("btnCustomerSearch.Image")));
			this.btnCustomerSearch.ImageAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("btnCustomerSearch.ImageAlign")));
			this.btnCustomerSearch.ImageIndex = ((int)(resources.GetObject("btnCustomerSearch.ImageIndex")));
			this.btnCustomerSearch.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("btnCustomerSearch.ImeMode")));
			this.btnCustomerSearch.Location = ((System.Drawing.Point)(resources.GetObject("btnCustomerSearch.Location")));
			this.btnCustomerSearch.Name = "btnCustomerSearch";
			this.btnCustomerSearch.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("btnCustomerSearch.RightToLeft")));
			this.btnCustomerSearch.Size = ((System.Drawing.Size)(resources.GetObject("btnCustomerSearch.Size")));
			this.btnCustomerSearch.TabIndex = ((int)(resources.GetObject("btnCustomerSearch.TabIndex")));
			this.btnCustomerSearch.Text = resources.GetString("btnCustomerSearch.Text");
			this.btnCustomerSearch.TextAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("btnCustomerSearch.TextAlign")));
			this.btnCustomerSearch.Visible = ((bool)(resources.GetObject("btnCustomerSearch.Visible")));
			this.btnCustomerSearch.Click += new System.EventHandler(this.btnCustomerSearch_Click);
			// 
			// lblCCN
			// 
			this.lblCCN.AccessibleDescription = resources.GetString("lblCCN.AccessibleDescription");
			this.lblCCN.AccessibleName = resources.GetString("lblCCN.AccessibleName");
			this.lblCCN.Anchor = ((System.Windows.Forms.AnchorStyles)(resources.GetObject("lblCCN.Anchor")));
			this.lblCCN.AutoSize = ((bool)(resources.GetObject("lblCCN.AutoSize")));
			this.lblCCN.Dock = ((System.Windows.Forms.DockStyle)(resources.GetObject("lblCCN.Dock")));
			this.lblCCN.Enabled = ((bool)(resources.GetObject("lblCCN.Enabled")));
			this.lblCCN.Font = ((System.Drawing.Font)(resources.GetObject("lblCCN.Font")));
			this.lblCCN.ForeColor = System.Drawing.Color.Maroon;
			this.lblCCN.Image = ((System.Drawing.Image)(resources.GetObject("lblCCN.Image")));
			this.lblCCN.ImageAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("lblCCN.ImageAlign")));
			this.lblCCN.ImageIndex = ((int)(resources.GetObject("lblCCN.ImageIndex")));
			this.lblCCN.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("lblCCN.ImeMode")));
			this.lblCCN.Location = ((System.Drawing.Point)(resources.GetObject("lblCCN.Location")));
			this.lblCCN.Name = "lblCCN";
			this.lblCCN.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("lblCCN.RightToLeft")));
			this.lblCCN.Size = ((System.Drawing.Size)(resources.GetObject("lblCCN.Size")));
			this.lblCCN.TabIndex = ((int)(resources.GetObject("lblCCN.TabIndex")));
			this.lblCCN.Text = resources.GetString("lblCCN.Text");
			this.lblCCN.TextAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("lblCCN.TextAlign")));
			this.lblCCN.Visible = ((bool)(resources.GetObject("lblCCN.Visible")));
			// 
			// btnCustomerNameSearch
			// 
			this.btnCustomerNameSearch.AccessibleDescription = resources.GetString("btnCustomerNameSearch.AccessibleDescription");
			this.btnCustomerNameSearch.AccessibleName = resources.GetString("btnCustomerNameSearch.AccessibleName");
			this.btnCustomerNameSearch.Anchor = ((System.Windows.Forms.AnchorStyles)(resources.GetObject("btnCustomerNameSearch.Anchor")));
			this.btnCustomerNameSearch.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("btnCustomerNameSearch.BackgroundImage")));
			this.btnCustomerNameSearch.Dock = ((System.Windows.Forms.DockStyle)(resources.GetObject("btnCustomerNameSearch.Dock")));
			this.btnCustomerNameSearch.Enabled = ((bool)(resources.GetObject("btnCustomerNameSearch.Enabled")));
			this.btnCustomerNameSearch.FlatStyle = ((System.Windows.Forms.FlatStyle)(resources.GetObject("btnCustomerNameSearch.FlatStyle")));
			this.btnCustomerNameSearch.Font = ((System.Drawing.Font)(resources.GetObject("btnCustomerNameSearch.Font")));
			this.btnCustomerNameSearch.Image = ((System.Drawing.Image)(resources.GetObject("btnCustomerNameSearch.Image")));
			this.btnCustomerNameSearch.ImageAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("btnCustomerNameSearch.ImageAlign")));
			this.btnCustomerNameSearch.ImageIndex = ((int)(resources.GetObject("btnCustomerNameSearch.ImageIndex")));
			this.btnCustomerNameSearch.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("btnCustomerNameSearch.ImeMode")));
			this.btnCustomerNameSearch.Location = ((System.Drawing.Point)(resources.GetObject("btnCustomerNameSearch.Location")));
			this.btnCustomerNameSearch.Name = "btnCustomerNameSearch";
			this.btnCustomerNameSearch.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("btnCustomerNameSearch.RightToLeft")));
			this.btnCustomerNameSearch.Size = ((System.Drawing.Size)(resources.GetObject("btnCustomerNameSearch.Size")));
			this.btnCustomerNameSearch.TabIndex = ((int)(resources.GetObject("btnCustomerNameSearch.TabIndex")));
			this.btnCustomerNameSearch.Text = resources.GetString("btnCustomerNameSearch.Text");
			this.btnCustomerNameSearch.TextAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("btnCustomerNameSearch.TextAlign")));
			this.btnCustomerNameSearch.Visible = ((bool)(resources.GetObject("btnCustomerNameSearch.Visible")));
			this.btnCustomerNameSearch.Click += new System.EventHandler(this.btnCustomerNameSearch_Click);
			// 
			// txtCustomerName
			// 
			this.txtCustomerName.AccessibleDescription = resources.GetString("txtCustomerName.AccessibleDescription");
			this.txtCustomerName.AccessibleName = resources.GetString("txtCustomerName.AccessibleName");
			this.txtCustomerName.Anchor = ((System.Windows.Forms.AnchorStyles)(resources.GetObject("txtCustomerName.Anchor")));
			this.txtCustomerName.AutoSize = ((bool)(resources.GetObject("txtCustomerName.AutoSize")));
			this.txtCustomerName.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("txtCustomerName.BackgroundImage")));
			this.txtCustomerName.Dock = ((System.Windows.Forms.DockStyle)(resources.GetObject("txtCustomerName.Dock")));
			this.txtCustomerName.Enabled = ((bool)(resources.GetObject("txtCustomerName.Enabled")));
			this.txtCustomerName.Font = ((System.Drawing.Font)(resources.GetObject("txtCustomerName.Font")));
			this.txtCustomerName.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("txtCustomerName.ImeMode")));
			this.txtCustomerName.Location = ((System.Drawing.Point)(resources.GetObject("txtCustomerName.Location")));
			this.txtCustomerName.MaxLength = ((int)(resources.GetObject("txtCustomerName.MaxLength")));
			this.txtCustomerName.Multiline = ((bool)(resources.GetObject("txtCustomerName.Multiline")));
			this.txtCustomerName.Name = "txtCustomerName";
			this.txtCustomerName.PasswordChar = ((char)(resources.GetObject("txtCustomerName.PasswordChar")));
			this.txtCustomerName.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("txtCustomerName.RightToLeft")));
			this.txtCustomerName.ScrollBars = ((System.Windows.Forms.ScrollBars)(resources.GetObject("txtCustomerName.ScrollBars")));
			this.txtCustomerName.Size = ((System.Drawing.Size)(resources.GetObject("txtCustomerName.Size")));
			this.txtCustomerName.TabIndex = ((int)(resources.GetObject("txtCustomerName.TabIndex")));
			this.txtCustomerName.Text = resources.GetString("txtCustomerName.Text");
			this.txtCustomerName.TextAlign = ((System.Windows.Forms.HorizontalAlignment)(resources.GetObject("txtCustomerName.TextAlign")));
			this.txtCustomerName.Visible = ((bool)(resources.GetObject("txtCustomerName.Visible")));
			this.txtCustomerName.WordWrap = ((bool)(resources.GetObject("txtCustomerName.WordWrap")));
			this.txtCustomerName.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txtCustomerName_KeyDown);
			this.txtCustomerName.Validating += new System.ComponentModel.CancelEventHandler(this.txtCustomerName_Validating);
			// 
			// txtCustomer
			// 
			this.txtCustomer.AccessibleDescription = resources.GetString("txtCustomer.AccessibleDescription");
			this.txtCustomer.AccessibleName = resources.GetString("txtCustomer.AccessibleName");
			this.txtCustomer.Anchor = ((System.Windows.Forms.AnchorStyles)(resources.GetObject("txtCustomer.Anchor")));
			this.txtCustomer.AutoSize = ((bool)(resources.GetObject("txtCustomer.AutoSize")));
			this.txtCustomer.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("txtCustomer.BackgroundImage")));
			this.txtCustomer.Dock = ((System.Windows.Forms.DockStyle)(resources.GetObject("txtCustomer.Dock")));
			this.txtCustomer.Enabled = ((bool)(resources.GetObject("txtCustomer.Enabled")));
			this.txtCustomer.Font = ((System.Drawing.Font)(resources.GetObject("txtCustomer.Font")));
			this.txtCustomer.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("txtCustomer.ImeMode")));
			this.txtCustomer.Location = ((System.Drawing.Point)(resources.GetObject("txtCustomer.Location")));
			this.txtCustomer.MaxLength = ((int)(resources.GetObject("txtCustomer.MaxLength")));
			this.txtCustomer.Multiline = ((bool)(resources.GetObject("txtCustomer.Multiline")));
			this.txtCustomer.Name = "txtCustomer";
			this.txtCustomer.PasswordChar = ((char)(resources.GetObject("txtCustomer.PasswordChar")));
			this.txtCustomer.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("txtCustomer.RightToLeft")));
			this.txtCustomer.ScrollBars = ((System.Windows.Forms.ScrollBars)(resources.GetObject("txtCustomer.ScrollBars")));
			this.txtCustomer.Size = ((System.Drawing.Size)(resources.GetObject("txtCustomer.Size")));
			this.txtCustomer.TabIndex = ((int)(resources.GetObject("txtCustomer.TabIndex")));
			this.txtCustomer.Text = resources.GetString("txtCustomer.Text");
			this.txtCustomer.TextAlign = ((System.Windows.Forms.HorizontalAlignment)(resources.GetObject("txtCustomer.TextAlign")));
			this.txtCustomer.Visible = ((bool)(resources.GetObject("txtCustomer.Visible")));
			this.txtCustomer.WordWrap = ((bool)(resources.GetObject("txtCustomer.WordWrap")));
			this.txtCustomer.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txtCustomer_KeyDown);
			this.txtCustomer.Validating += new System.ComponentModel.CancelEventHandler(this.txtCustomer_Validating);
			// 
			// lblCustomerName
			// 
			this.lblCustomerName.AccessibleDescription = resources.GetString("lblCustomerName.AccessibleDescription");
			this.lblCustomerName.AccessibleName = resources.GetString("lblCustomerName.AccessibleName");
			this.lblCustomerName.Anchor = ((System.Windows.Forms.AnchorStyles)(resources.GetObject("lblCustomerName.Anchor")));
			this.lblCustomerName.AutoSize = ((bool)(resources.GetObject("lblCustomerName.AutoSize")));
			this.lblCustomerName.Dock = ((System.Windows.Forms.DockStyle)(resources.GetObject("lblCustomerName.Dock")));
			this.lblCustomerName.Enabled = ((bool)(resources.GetObject("lblCustomerName.Enabled")));
			this.lblCustomerName.Font = ((System.Drawing.Font)(resources.GetObject("lblCustomerName.Font")));
			this.lblCustomerName.ForeColor = System.Drawing.Color.Maroon;
			this.lblCustomerName.Image = ((System.Drawing.Image)(resources.GetObject("lblCustomerName.Image")));
			this.lblCustomerName.ImageAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("lblCustomerName.ImageAlign")));
			this.lblCustomerName.ImageIndex = ((int)(resources.GetObject("lblCustomerName.ImageIndex")));
			this.lblCustomerName.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("lblCustomerName.ImeMode")));
			this.lblCustomerName.Location = ((System.Drawing.Point)(resources.GetObject("lblCustomerName.Location")));
			this.lblCustomerName.Name = "lblCustomerName";
			this.lblCustomerName.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("lblCustomerName.RightToLeft")));
			this.lblCustomerName.Size = ((System.Drawing.Size)(resources.GetObject("lblCustomerName.Size")));
			this.lblCustomerName.TabIndex = ((int)(resources.GetObject("lblCustomerName.TabIndex")));
			this.lblCustomerName.Text = resources.GetString("lblCustomerName.Text");
			this.lblCustomerName.TextAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("lblCustomerName.TextAlign")));
			this.lblCustomerName.Visible = ((bool)(resources.GetObject("lblCustomerName.Visible")));
			// 
			// lblCustomer
			// 
			this.lblCustomer.AccessibleDescription = resources.GetString("lblCustomer.AccessibleDescription");
			this.lblCustomer.AccessibleName = resources.GetString("lblCustomer.AccessibleName");
			this.lblCustomer.Anchor = ((System.Windows.Forms.AnchorStyles)(resources.GetObject("lblCustomer.Anchor")));
			this.lblCustomer.AutoSize = ((bool)(resources.GetObject("lblCustomer.AutoSize")));
			this.lblCustomer.Dock = ((System.Windows.Forms.DockStyle)(resources.GetObject("lblCustomer.Dock")));
			this.lblCustomer.Enabled = ((bool)(resources.GetObject("lblCustomer.Enabled")));
			this.lblCustomer.Font = ((System.Drawing.Font)(resources.GetObject("lblCustomer.Font")));
			this.lblCustomer.ForeColor = System.Drawing.Color.Maroon;
			this.lblCustomer.Image = ((System.Drawing.Image)(resources.GetObject("lblCustomer.Image")));
			this.lblCustomer.ImageAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("lblCustomer.ImageAlign")));
			this.lblCustomer.ImageIndex = ((int)(resources.GetObject("lblCustomer.ImageIndex")));
			this.lblCustomer.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("lblCustomer.ImeMode")));
			this.lblCustomer.Location = ((System.Drawing.Point)(resources.GetObject("lblCustomer.Location")));
			this.lblCustomer.Name = "lblCustomer";
			this.lblCustomer.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("lblCustomer.RightToLeft")));
			this.lblCustomer.Size = ((System.Drawing.Size)(resources.GetObject("lblCustomer.Size")));
			this.lblCustomer.TabIndex = ((int)(resources.GetObject("lblCustomer.TabIndex")));
			this.lblCustomer.Text = resources.GetString("lblCustomer.Text");
			this.lblCustomer.TextAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("lblCustomer.TextAlign")));
			this.lblCustomer.Visible = ((bool)(resources.GetObject("lblCustomer.Visible")));
			// 
			// dgrdData
			// 
			this.dgrdData.AccessibleDescription = resources.GetString("dgrdData.AccessibleDescription");
			this.dgrdData.AccessibleName = resources.GetString("dgrdData.AccessibleName");
			this.dgrdData.AllowAddNew = ((bool)(resources.GetObject("dgrdData.AllowAddNew")));
			this.dgrdData.AllowArrows = ((bool)(resources.GetObject("dgrdData.AllowArrows")));
			this.dgrdData.AllowColMove = ((bool)(resources.GetObject("dgrdData.AllowColMove")));
			this.dgrdData.AllowColSelect = ((bool)(resources.GetObject("dgrdData.AllowColSelect")));
			this.dgrdData.AllowDelete = ((bool)(resources.GetObject("dgrdData.AllowDelete")));
			this.dgrdData.AllowDrag = ((bool)(resources.GetObject("dgrdData.AllowDrag")));
			this.dgrdData.AllowFilter = ((bool)(resources.GetObject("dgrdData.AllowFilter")));
			this.dgrdData.AllowHorizontalSplit = ((bool)(resources.GetObject("dgrdData.AllowHorizontalSplit")));
			this.dgrdData.AllowRowSelect = ((bool)(resources.GetObject("dgrdData.AllowRowSelect")));
			this.dgrdData.AllowSort = ((bool)(resources.GetObject("dgrdData.AllowSort")));
			this.dgrdData.AllowUpdate = ((bool)(resources.GetObject("dgrdData.AllowUpdate")));
			this.dgrdData.AllowUpdateOnBlur = ((bool)(resources.GetObject("dgrdData.AllowUpdateOnBlur")));
			this.dgrdData.AllowVerticalSplit = ((bool)(resources.GetObject("dgrdData.AllowVerticalSplit")));
			this.dgrdData.AlternatingRows = ((bool)(resources.GetObject("dgrdData.AlternatingRows")));
			this.dgrdData.Anchor = ((System.Windows.Forms.AnchorStyles)(resources.GetObject("dgrdData.Anchor")));
			this.dgrdData.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("dgrdData.BackgroundImage")));
			this.dgrdData.BorderStyle = ((System.Windows.Forms.BorderStyle)(resources.GetObject("dgrdData.BorderStyle")));
			this.dgrdData.Caption = resources.GetString("dgrdData.Caption");
			this.dgrdData.CaptionHeight = ((int)(resources.GetObject("dgrdData.CaptionHeight")));
			this.dgrdData.CellTipsDelay = ((int)(resources.GetObject("dgrdData.CellTipsDelay")));
			this.dgrdData.CellTipsWidth = ((int)(resources.GetObject("dgrdData.CellTipsWidth")));
			this.dgrdData.ChildGrid = ((C1.Win.C1TrueDBGrid.C1TrueDBGrid)(resources.GetObject("dgrdData.ChildGrid")));
			this.dgrdData.CollapseColor = ((System.Drawing.Color)(resources.GetObject("dgrdData.CollapseColor")));
			this.dgrdData.ColumnFooters = ((bool)(resources.GetObject("dgrdData.ColumnFooters")));
			this.dgrdData.ColumnHeaders = ((bool)(resources.GetObject("dgrdData.ColumnHeaders")));
			this.dgrdData.DefColWidth = ((int)(resources.GetObject("dgrdData.DefColWidth")));
			this.dgrdData.Dock = ((System.Windows.Forms.DockStyle)(resources.GetObject("dgrdData.Dock")));
			this.dgrdData.EditDropDown = ((bool)(resources.GetObject("dgrdData.EditDropDown")));
			this.dgrdData.EmptyRows = ((bool)(resources.GetObject("dgrdData.EmptyRows")));
			this.dgrdData.Enabled = ((bool)(resources.GetObject("dgrdData.Enabled")));
			this.dgrdData.ExpandColor = ((System.Drawing.Color)(resources.GetObject("dgrdData.ExpandColor")));
			this.dgrdData.ExposeCellMode = ((C1.Win.C1TrueDBGrid.ExposeCellModeEnum)(resources.GetObject("dgrdData.ExposeCellMode")));
			this.dgrdData.ExtendRightColumn = ((bool)(resources.GetObject("dgrdData.ExtendRightColumn")));
			this.dgrdData.FetchRowStyles = ((bool)(resources.GetObject("dgrdData.FetchRowStyles")));
			this.dgrdData.FilterBar = ((bool)(resources.GetObject("dgrdData.FilterBar")));
			this.dgrdData.FlatStyle = ((C1.Win.C1TrueDBGrid.FlatModeEnum)(resources.GetObject("dgrdData.FlatStyle")));
			this.dgrdData.Font = ((System.Drawing.Font)(resources.GetObject("dgrdData.Font")));
			this.dgrdData.GroupByAreaVisible = ((bool)(resources.GetObject("dgrdData.GroupByAreaVisible")));
			this.dgrdData.GroupByCaption = resources.GetString("dgrdData.GroupByCaption");
			this.dgrdData.Images.Add(((System.Drawing.Image)(resources.GetObject("resource"))));
			this.dgrdData.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("dgrdData.ImeMode")));
			this.dgrdData.LinesPerRow = ((int)(resources.GetObject("dgrdData.LinesPerRow")));
			this.dgrdData.Location = ((System.Drawing.Point)(resources.GetObject("dgrdData.Location")));
			this.dgrdData.MarqueeStyle = C1.Win.C1TrueDBGrid.MarqueeEnum.DottedCellBorder;
			this.dgrdData.Name = "dgrdData";
			this.dgrdData.PictureAddnewRow = ((System.Drawing.Image)(resources.GetObject("dgrdData.PictureAddnewRow")));
			this.dgrdData.PictureCurrentRow = ((System.Drawing.Image)(resources.GetObject("dgrdData.PictureCurrentRow")));
			this.dgrdData.PictureFilterBar = ((System.Drawing.Image)(resources.GetObject("dgrdData.PictureFilterBar")));
			this.dgrdData.PictureFooterRow = ((System.Drawing.Image)(resources.GetObject("dgrdData.PictureFooterRow")));
			this.dgrdData.PictureHeaderRow = ((System.Drawing.Image)(resources.GetObject("dgrdData.PictureHeaderRow")));
			this.dgrdData.PictureModifiedRow = ((System.Drawing.Image)(resources.GetObject("dgrdData.PictureModifiedRow")));
			this.dgrdData.PictureStandardRow = ((System.Drawing.Image)(resources.GetObject("dgrdData.PictureStandardRow")));
			this.dgrdData.PreviewInfo.AllowSizing = ((bool)(resources.GetObject("dgrdData.PreviewInfo.AllowSizing")));
			this.dgrdData.PreviewInfo.Caption = resources.GetString("dgrdData.PreviewInfo.Caption");
			this.dgrdData.PreviewInfo.Location = ((System.Drawing.Point)(resources.GetObject("dgrdData.PreviewInfo.Location")));
			this.dgrdData.PreviewInfo.Size = ((System.Drawing.Size)(resources.GetObject("dgrdData.PreviewInfo.Size")));
			this.dgrdData.PreviewInfo.ToolBars = ((bool)(resources.GetObject("dgrdData.PreviewInfo.ToolBars")));
			this.dgrdData.PreviewInfo.UIStrings.Content = ((string[])(resources.GetObject("dgrdData.PreviewInfo.UIStrings.Content")));
			this.dgrdData.PreviewInfo.ZoomFactor = ((System.Double)(resources.GetObject("dgrdData.PreviewInfo.ZoomFactor")));
			this.dgrdData.PrintInfo.MaxRowHeight = ((int)(resources.GetObject("dgrdData.PrintInfo.MaxRowHeight")));
			this.dgrdData.PrintInfo.OwnerDrawPageFooter = ((bool)(resources.GetObject("dgrdData.PrintInfo.OwnerDrawPageFooter")));
			this.dgrdData.PrintInfo.OwnerDrawPageHeader = ((bool)(resources.GetObject("dgrdData.PrintInfo.OwnerDrawPageHeader")));
			this.dgrdData.PrintInfo.PageFooter = resources.GetString("dgrdData.PrintInfo.PageFooter");
			this.dgrdData.PrintInfo.PageFooterHeight = ((int)(resources.GetObject("dgrdData.PrintInfo.PageFooterHeight")));
			this.dgrdData.PrintInfo.PageHeader = resources.GetString("dgrdData.PrintInfo.PageHeader");
			this.dgrdData.PrintInfo.PageHeaderHeight = ((int)(resources.GetObject("dgrdData.PrintInfo.PageHeaderHeight")));
			this.dgrdData.PrintInfo.PrintHorizontalSplits = ((bool)(resources.GetObject("dgrdData.PrintInfo.PrintHorizontalSplits")));
			this.dgrdData.PrintInfo.ProgressCaption = resources.GetString("dgrdData.PrintInfo.ProgressCaption");
			this.dgrdData.PrintInfo.RepeatColumnFooters = ((bool)(resources.GetObject("dgrdData.PrintInfo.RepeatColumnFooters")));
			this.dgrdData.PrintInfo.RepeatColumnHeaders = ((bool)(resources.GetObject("dgrdData.PrintInfo.RepeatColumnHeaders")));
			this.dgrdData.PrintInfo.RepeatGridHeader = ((bool)(resources.GetObject("dgrdData.PrintInfo.RepeatGridHeader")));
			this.dgrdData.PrintInfo.RepeatSplitHeaders = ((bool)(resources.GetObject("dgrdData.PrintInfo.RepeatSplitHeaders")));
			this.dgrdData.PrintInfo.ShowOptionsDialog = ((bool)(resources.GetObject("dgrdData.PrintInfo.ShowOptionsDialog")));
			this.dgrdData.PrintInfo.ShowProgressForm = ((bool)(resources.GetObject("dgrdData.PrintInfo.ShowProgressForm")));
			this.dgrdData.PrintInfo.ShowSelection = ((bool)(resources.GetObject("dgrdData.PrintInfo.ShowSelection")));
			this.dgrdData.PrintInfo.UseGridColors = ((bool)(resources.GetObject("dgrdData.PrintInfo.UseGridColors")));
			this.dgrdData.RecordSelectors = ((bool)(resources.GetObject("dgrdData.RecordSelectors")));
			this.dgrdData.RecordSelectorWidth = ((int)(resources.GetObject("dgrdData.RecordSelectorWidth")));
			this.dgrdData.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("dgrdData.RightToLeft")));
			this.dgrdData.RowDivider.Color = ((System.Drawing.Color)(resources.GetObject("resource.Color")));
			this.dgrdData.RowDivider.Style = ((C1.Win.C1TrueDBGrid.LineStyleEnum)(resources.GetObject("resource.Style")));
			this.dgrdData.RowHeight = ((int)(resources.GetObject("dgrdData.RowHeight")));
			this.dgrdData.RowSubDividerColor = ((System.Drawing.Color)(resources.GetObject("dgrdData.RowSubDividerColor")));
			this.dgrdData.ScrollTips = ((bool)(resources.GetObject("dgrdData.ScrollTips")));
			this.dgrdData.ScrollTrack = ((bool)(resources.GetObject("dgrdData.ScrollTrack")));
			this.dgrdData.Size = ((System.Drawing.Size)(resources.GetObject("dgrdData.Size")));
			this.dgrdData.SpringMode = ((bool)(resources.GetObject("dgrdData.SpringMode")));
			this.dgrdData.TabAcrossSplits = ((bool)(resources.GetObject("dgrdData.TabAcrossSplits")));
			this.dgrdData.TabIndex = ((int)(resources.GetObject("dgrdData.TabIndex")));
			this.dgrdData.Text = resources.GetString("dgrdData.Text");
			this.dgrdData.ViewCaptionWidth = ((int)(resources.GetObject("dgrdData.ViewCaptionWidth")));
			this.dgrdData.ViewColumnWidth = ((int)(resources.GetObject("dgrdData.ViewColumnWidth")));
			this.dgrdData.Visible = ((bool)(resources.GetObject("dgrdData.Visible")));
			this.dgrdData.WrapCellPointer = ((bool)(resources.GetObject("dgrdData.WrapCellPointer")));
			this.dgrdData.BeforeColEdit += new C1.Win.C1TrueDBGrid.BeforeColEditEventHandler(this.dgrdData_BeforeColEdit);
			this.dgrdData.ButtonClick += new C1.Win.C1TrueDBGrid.ColEventHandler(this.dgrdData_ButtonClick);
			this.dgrdData.AfterColUpdate += new C1.Win.C1TrueDBGrid.ColEventHandler(this.dgrdData_AfterColUpdate);
			this.dgrdData.BeforeColUpdate += new C1.Win.C1TrueDBGrid.BeforeColUpdateEventHandler(this.dgrdData_BeforeColUpdate);
			this.dgrdData.KeyDown += new System.Windows.Forms.KeyEventHandler(this.dgrdData_KeyDown);
			this.dgrdData.PropBag = resources.GetString("dgrdData.PropBag");
			// 
			// txtCurrency
			// 
			this.txtCurrency.AccessibleDescription = resources.GetString("txtCurrency.AccessibleDescription");
			this.txtCurrency.AccessibleName = resources.GetString("txtCurrency.AccessibleName");
			this.txtCurrency.Anchor = ((System.Windows.Forms.AnchorStyles)(resources.GetObject("txtCurrency.Anchor")));
			this.txtCurrency.AutoSize = ((bool)(resources.GetObject("txtCurrency.AutoSize")));
			this.txtCurrency.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("txtCurrency.BackgroundImage")));
			this.txtCurrency.Dock = ((System.Windows.Forms.DockStyle)(resources.GetObject("txtCurrency.Dock")));
			this.txtCurrency.Enabled = ((bool)(resources.GetObject("txtCurrency.Enabled")));
			this.txtCurrency.Font = ((System.Drawing.Font)(resources.GetObject("txtCurrency.Font")));
			this.txtCurrency.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("txtCurrency.ImeMode")));
			this.txtCurrency.Location = ((System.Drawing.Point)(resources.GetObject("txtCurrency.Location")));
			this.txtCurrency.MaxLength = ((int)(resources.GetObject("txtCurrency.MaxLength")));
			this.txtCurrency.Multiline = ((bool)(resources.GetObject("txtCurrency.Multiline")));
			this.txtCurrency.Name = "txtCurrency";
			this.txtCurrency.PasswordChar = ((char)(resources.GetObject("txtCurrency.PasswordChar")));
			this.txtCurrency.ReadOnly = true;
			this.txtCurrency.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("txtCurrency.RightToLeft")));
			this.txtCurrency.ScrollBars = ((System.Windows.Forms.ScrollBars)(resources.GetObject("txtCurrency.ScrollBars")));
			this.txtCurrency.Size = ((System.Drawing.Size)(resources.GetObject("txtCurrency.Size")));
			this.txtCurrency.TabIndex = ((int)(resources.GetObject("txtCurrency.TabIndex")));
			this.txtCurrency.Text = resources.GetString("txtCurrency.Text");
			this.txtCurrency.TextAlign = ((System.Windows.Forms.HorizontalAlignment)(resources.GetObject("txtCurrency.TextAlign")));
			this.txtCurrency.Visible = ((bool)(resources.GetObject("txtCurrency.Visible")));
			this.txtCurrency.WordWrap = ((bool)(resources.GetObject("txtCurrency.WordWrap")));
			// 
			// lblCurrency
			// 
			this.lblCurrency.AccessibleDescription = resources.GetString("lblCurrency.AccessibleDescription");
			this.lblCurrency.AccessibleName = resources.GetString("lblCurrency.AccessibleName");
			this.lblCurrency.Anchor = ((System.Windows.Forms.AnchorStyles)(resources.GetObject("lblCurrency.Anchor")));
			this.lblCurrency.AutoSize = ((bool)(resources.GetObject("lblCurrency.AutoSize")));
			this.lblCurrency.Dock = ((System.Windows.Forms.DockStyle)(resources.GetObject("lblCurrency.Dock")));
			this.lblCurrency.Enabled = ((bool)(resources.GetObject("lblCurrency.Enabled")));
			this.lblCurrency.Font = ((System.Drawing.Font)(resources.GetObject("lblCurrency.Font")));
			this.lblCurrency.ForeColor = System.Drawing.Color.Black;
			this.lblCurrency.Image = ((System.Drawing.Image)(resources.GetObject("lblCurrency.Image")));
			this.lblCurrency.ImageAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("lblCurrency.ImageAlign")));
			this.lblCurrency.ImageIndex = ((int)(resources.GetObject("lblCurrency.ImageIndex")));
			this.lblCurrency.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("lblCurrency.ImeMode")));
			this.lblCurrency.Location = ((System.Drawing.Point)(resources.GetObject("lblCurrency.Location")));
			this.lblCurrency.Name = "lblCurrency";
			this.lblCurrency.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("lblCurrency.RightToLeft")));
			this.lblCurrency.Size = ((System.Drawing.Size)(resources.GetObject("lblCurrency.Size")));
			this.lblCurrency.TabIndex = ((int)(resources.GetObject("lblCurrency.TabIndex")));
			this.lblCurrency.Text = resources.GetString("lblCurrency.Text");
			this.lblCurrency.TextAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("lblCurrency.TextAlign")));
			this.lblCurrency.Visible = ((bool)(resources.GetObject("lblCurrency.Visible")));
			// 
			// CustomerAndItemReference
			// 
			this.AccessibleDescription = resources.GetString("$this.AccessibleDescription");
			this.AccessibleName = resources.GetString("$this.AccessibleName");
			this.AutoScaleBaseSize = ((System.Drawing.Size)(resources.GetObject("$this.AutoScaleBaseSize")));
			this.AutoScroll = ((bool)(resources.GetObject("$this.AutoScroll")));
			this.AutoScrollMargin = ((System.Drawing.Size)(resources.GetObject("$this.AutoScrollMargin")));
			this.AutoScrollMinSize = ((System.Drawing.Size)(resources.GetObject("$this.AutoScrollMinSize")));
			this.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("$this.BackgroundImage")));
			this.ClientSize = ((System.Drawing.Size)(resources.GetObject("$this.ClientSize")));
			this.Controls.Add(this.txtCurrency);
			this.Controls.Add(this.dgrdData);
			this.Controls.Add(this.txtCustomerName);
			this.Controls.Add(this.txtCustomer);
			this.Controls.Add(this.lblCurrency);
			this.Controls.Add(this.cboCCN);
			this.Controls.Add(this.btnCustomerSearch);
			this.Controls.Add(this.lblCCN);
			this.Controls.Add(this.btnCustomerNameSearch);
			this.Controls.Add(this.lblCustomerName);
			this.Controls.Add(this.lblCustomer);
			this.Controls.Add(this.btnClose);
			this.Controls.Add(this.btnDelete);
			this.Controls.Add(this.btnHelp);
			this.Controls.Add(this.btnSave);
			this.Enabled = ((bool)(resources.GetObject("$this.Enabled")));
			this.Font = ((System.Drawing.Font)(resources.GetObject("$this.Font")));
			this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
			this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
			this.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("$this.ImeMode")));
			this.KeyPreview = true;
			this.Location = ((System.Drawing.Point)(resources.GetObject("$this.Location")));
			this.MaximumSize = ((System.Drawing.Size)(resources.GetObject("$this.MaximumSize")));
			this.MinimumSize = ((System.Drawing.Size)(resources.GetObject("$this.MinimumSize")));
			this.Name = "CustomerAndItemReference";
			this.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("$this.RightToLeft")));
			this.StartPosition = ((System.Windows.Forms.FormStartPosition)(resources.GetObject("$this.StartPosition")));
			this.Text = resources.GetString("$this.Text");
			this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.CustomerAndItemReference_KeyDown);
			this.Closing += new System.ComponentModel.CancelEventHandler(this.CustomerAndItemReference_Closing);
			this.Load += new System.EventHandler(this.CustomerAndItemReference_Load);
			((System.ComponentModel.ISupportInitialize)(this.cboCCN)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.dgrdData)).EndInit();
			this.ResumeLayout(false);

		}
		#endregion
		private void CustomerAndItemReference_Load(object sender, System.EventArgs e)
		{
			const string METHOD_NAME = THIS + ".CustomerAndItemReference_Load()";
			try
			{
				Security objSecurity = new Security();
				this.Name = THIS;
				objSecurity.SetRightForUserOnForm(this, SystemProperty.UserName);

				//Load CCN and set default CCN
				UtilsBO boUtils = new UtilsBO();
				DataSet dstCCN = boUtils.ListCCN();
				cboCCN.DataSource = dstCCN.Tables[MST_CCNTable.TABLE_NAME];
				cboCCN.DisplayMember	= MST_CCNTable.CODE_FLD;
				cboCCN.ValueMember		= MST_CCNTable.CCNID_FLD;
				FormControlComponents.PutDataIntoC1ComboBox(cboCCN,dstCCN.Tables[MST_CCNTable.TABLE_NAME],MST_CCNTable.CODE_FLD,MST_CCNTable.CCNID_FLD,MST_CCNTable.TABLE_NAME);

				//get grid layout
				dtbGridLayOut = FormControlComponents.StoreGridLayout(dgrdData);

				if (SystemProperty.CCNID != 0)
				{
					cboCCN.SelectedValue = SystemProperty.CCNID;
				}
				BindDataToGrid(0, 0);
			}
			catch (PCSException ex)
			{
				// Displays the error message if throwed from PCSException.
				PCSMessageBox.Show(ex.mCode, MessageBoxIcon.Error);
				try
				{
					// Log error message into log file.
					Logger.LogMessage(ex.CauseException, METHOD_NAME, Level.ERROR);
				}
				catch
				{
					// Show message if logger has an error.
					PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxIcon.Error);
				}
			}
			catch (Exception ex)
			{
				// Displays the error message if throwed from system.
				PCSMessageBox.Show(ErrorCode.OTHER_ERROR, MessageBoxIcon.Error);
				try
				{
					// Log error message into log file.
					Logger.LogMessage(ex, METHOD_NAME, Level.ERROR);
				}
				catch
				{
					// Show message if logger has an error.
					PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxIcon.Error);
				}
			}
		}

		/// <summary>
		/// 
		/// </summary>
		/// <param name="pintPartyID"></param>
		/// <param name="pintCCNID"></param>
		private void BindDataToGrid(int pintPartyID, int pintCCNID)
		{
			const string METHOD_NAME = THIS + ".BindDataToGrid()";
			try
			{
				dstData = boCustomerAndItem.ListDetailByMasterID(pintPartyID, pintCCNID);
				dgrdData.DataSource = dstData.Tables[0];

				FormControlComponents.RestoreGridLayout(dgrdData, dtbGridLayOut);
				// ThuyPt require
				//dgrdData.Columns[SO_CustomerItemRefDetailTable.UNITPRICE_FLD].NumberFormat = Constants.DECIMAL_NUMBERFORMAT;
				dgrdData.Columns[SO_CustomerItemRefDetailTable.UNITPRICE_FLD].NumberFormat ="##############,0.0000";
				dgrdData.Columns[SO_CustomerItemRefDetailTable.CUSTOMERITEMCODE_FLD].DataWidth = 50;
				dgrdData.Columns[SO_CustomerItemRefDetailTable.UNITPRICE_FLD].DataWidth = 10;
				dgrdData.Columns[SO_CustomerItemRefDetailTable.CUSTOMERITEMMODEL_FLD].DataWidth = 20;
				dgrdData.Splits[0].DisplayColumns[ITM_ProductTable.REVISION_FLD].Locked = true;
				dgrdData.Splits[0].DisplayColumns[ITM_ProductTable.CODE_FLD].Button = true;
				dgrdData.Splits[0].DisplayColumns[ITM_ProductTable.DESCRIPTION_FLD].Button = true;
				dgrdData.Splits[0].DisplayColumns[MST_UnitOfMeasureTable.TABLE_NAME + MST_UnitOfMeasureTable.CODE_FLD].Button = true;

				voCustomMaster.CustomerItemRefMasterID = ((SO_CustomerItemRefMasterVO) boCustomerAndItem.GetObjectMasterByID(pintPartyID, pintCCNID)).CustomerItemRefMasterID;
				if (pintPartyID != 0)
				{
					btnSave.Enabled = true;
					btnDelete.Enabled = true;
				}
			}
			catch (PCSException ex)
			{
				throw new PCSException(ex.mCode, METHOD_NAME, ex);
			}
			catch (Exception ex)
			{
				throw new Exception(ex.Message, ex);
			}
		}
		
		/// <summary>
		/// Select Customer by Code
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void btnCustomerSearch_Click(object sender, System.EventArgs e)
		{
			const string METHOD_NAME = THIS + ".btnCustomerSearch_Click()";
			try
			{
				Hashtable htbCriteria = new Hashtable();
				DataRowView drwResult = null;
				htbCriteria = new Hashtable();
				htbCriteria.Add(CUSTOMER_FLD, (int)PartyTypeEnum.CUSTOMER);
				drwResult = FormControlComponents.OpenSearchForm(V_VENDORCUSTOMER, MST_PartyTable.CODE_FLD, txtCustomer.Text.Trim(), htbCriteria, true);
				if (drwResult != null)
				{
					txtCustomer.Text = drwResult[MST_PartyTable.CODE_FLD].ToString();
					txtCustomer.Tag = drwResult[MST_PartyTable.PARTYID_FLD];
					txtCustomerName.Text = drwResult[MST_PartyTable.NAME_FLD].ToString();
					BindDataToGrid(int.Parse(txtCustomer.Tag.ToString()), int.Parse(cboCCN.SelectedValue.ToString()));
					voCustomMaster.PartyID = int.Parse(txtCustomer.Tag.ToString());
					voCustomMaster.CCNID = int.Parse(cboCCN.SelectedValue.ToString());
					txtCurrency.Text = drwResult["MST_PartyCurrency"].ToString();
				}
			}
			catch (PCSException ex)
			{
				// Displays the error message if throwed from PCSException.
				PCSMessageBox.Show(ex.mCode, MessageBoxIcon.Error);
				try
				{
					// Log error message into log file.
					Logger.LogMessage(ex.CauseException, METHOD_NAME, Level.ERROR);
				}
				catch
				{
					// Show message if logger has an error.
					PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxIcon.Error);
				}
			}
			catch (Exception ex)
			{
				// Displays the error message if throwed from system.
				PCSMessageBox.Show(ErrorCode.OTHER_ERROR, MessageBoxIcon.Error);
				try
				{
					// Log error message into log file.
					Logger.LogMessage(ex, METHOD_NAME, Level.ERROR);
				}
				catch
				{
					// Show message if logger has an error.
					PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxIcon.Error);
				}
			}
		}

		/// <summary>
		/// Select Customer by Name
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void btnCustomerNameSearch_Click(object sender, System.EventArgs e)
		{
			const string METHOD_NAME = THIS + ".btnCustomerNameSearch_Click()";
			try
			{
				Hashtable htbCriteria = new Hashtable();
				DataRowView drwResult = null;
				htbCriteria = new Hashtable();
				htbCriteria.Add(CUSTOMER_FLD, (int)PartyTypeEnum.CUSTOMER);
				drwResult = FormControlComponents.OpenSearchForm(V_VENDORCUSTOMER, MST_PartyTable.NAME_FLD, txtCustomerName.Text.Trim(), htbCriteria, true);
				if (drwResult != null)
				{
					txtCustomer.Text = drwResult[MST_PartyTable.CODE_FLD].ToString();
					txtCustomer.Tag = drwResult[MST_PartyTable.PARTYID_FLD];
					txtCustomerName.Text = drwResult[MST_PartyTable.NAME_FLD].ToString();
					BindDataToGrid(int.Parse(txtCustomer.Tag.ToString()), int.Parse(cboCCN.SelectedValue.ToString()));
					voCustomMaster.PartyID = int.Parse(txtCustomer.Tag.ToString());
					voCustomMaster.CCNID = int.Parse(cboCCN.SelectedValue.ToString());
					txtCurrency.Text = drwResult["MST_PartyCurrency"].ToString();
				}
			}
			catch (PCSException ex)
			{
				// Displays the error message if throwed from PCSException.
				PCSMessageBox.Show(ex.mCode, MessageBoxIcon.Error);
				try
				{
					// Log error message into log file.
					Logger.LogMessage(ex.CauseException, METHOD_NAME, Level.ERROR);
				}
				catch
				{
					// Show message if logger has an error.
					PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxIcon.Error);
				}
			}
			catch (Exception ex)
			{
				// Displays the error message if throwed from system.
				PCSMessageBox.Show(ErrorCode.OTHER_ERROR, MessageBoxIcon.Error);
				try
				{
					// Log error message into log file.
					Logger.LogMessage(ex, METHOD_NAME, Level.ERROR);
				}
				catch
				{
					// Show message if logger has an error.
					PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxIcon.Error);
				}
			}
		}

		private void btnClose_Click(object sender, System.EventArgs e)
		{
			this.Close();
		}
		
		/// <summary>
		/// Validating event: - OpenSeachForm
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void txtCustomer_Validating(object sender, System.ComponentModel.CancelEventArgs e)
		{
			const string METHOD_NAME = THIS + ".txtCustomer_Validating()";
			try
			{
				Hashtable htbCriteria = new Hashtable();
				DataRowView drwResult = null;
				if(txtCustomer.Text.Trim() == string.Empty)
				{
					txtCustomer.Tag = null;
					txtCustomerName.Text = string.Empty;
					btnSave.Enabled = false;
					btnDelete.Enabled = false;
					BindDataToGrid(0, 0);
					return;
				}
				htbCriteria = new Hashtable();
				htbCriteria.Add(CUSTOMER_FLD, 0);
				drwResult = FormControlComponents.OpenSearchForm(V_VENDORCUSTOMER, MST_PartyTable.CODE_FLD, txtCustomer.Text.Trim(), htbCriteria, false);
				if (drwResult != null)
				{
					txtCustomer.Text = drwResult[MST_PartyTable.CODE_FLD].ToString();
					txtCustomer.Tag = drwResult[MST_PartyTable.PARTYID_FLD];
					txtCustomerName.Text = drwResult[MST_PartyTable.NAME_FLD].ToString();
					voCustomMaster.PartyID = int.Parse(txtCustomer.Tag.ToString());
					voCustomMaster.CCNID = int.Parse(cboCCN.SelectedValue.ToString());
					txtCurrency.Text = drwResult["MST_PartyCurrency"].ToString();
					BindDataToGrid(int.Parse(txtCustomer.Tag.ToString()), int.Parse(cboCCN.SelectedValue.ToString()));
				}
				else 
					e.Cancel = true;
			}
			catch (PCSException ex)
			{
				// Displays the error message if throwed from PCSException.
				PCSMessageBox.Show(ex.mCode, MessageBoxIcon.Error);
				try
				{
					// Log error message into log file.
					Logger.LogMessage(ex.CauseException, METHOD_NAME, Level.ERROR);
				}
				catch
				{
					// Show message if logger has an error.
					PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxIcon.Error);
				}
			}
			catch (Exception ex)
			{
				// Displays the error message if throwed from system.
				PCSMessageBox.Show(ErrorCode.OTHER_ERROR, MessageBoxIcon.Error);
				try
				{
					// Log error message into log file.
					Logger.LogMessage(ex, METHOD_NAME, Level.ERROR);
				}
				catch
				{
					// Show message if logger has an error.
					PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxIcon.Error);
				}
			}
		}
		
		/// <summary>
		/// Validating data on Customer Name
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void txtCustomerName_Validating(object sender, System.ComponentModel.CancelEventArgs e)
		{
			const string METHOD_NAME = THIS + ".txtCustomer_Validating()";
			try
			{
				Hashtable htbCriteria = new Hashtable();
				DataRowView drwResult = null;
				if(txtCustomerName.Text.Trim() == string.Empty)
				{
					txtCustomer.Tag = null;
					txtCustomer.Text= string.Empty;
					txtCustomerName.Text = string.Empty;
					btnSave.Enabled = false;
					btnDelete.Enabled = false;
					BindDataToGrid(0, 0);
					return;
				}
				htbCriteria = new Hashtable();
				htbCriteria.Add(CUSTOMER_FLD, 0);
				drwResult = FormControlComponents.OpenSearchForm(V_VENDORCUSTOMER, MST_PartyTable.NAME_FLD, txtCustomerName.Text.Trim(), htbCriteria, false);
				if (drwResult != null)
				{
					txtCustomer.Text = drwResult[MST_PartyTable.CODE_FLD].ToString();
					txtCustomer.Tag = drwResult[MST_PartyTable.PARTYID_FLD];
					txtCustomerName.Text = drwResult[MST_PartyTable.NAME_FLD].ToString();
					voCustomMaster.PartyID = int.Parse(txtCustomer.Tag.ToString());
					voCustomMaster.CCNID = int.Parse(cboCCN.SelectedValue.ToString());
					txtCurrency.Text = drwResult["MST_PartyCurrency"].ToString();
					BindDataToGrid(int.Parse(txtCustomer.Tag.ToString()), int.Parse(cboCCN.SelectedValue.ToString()));
				}
				else 
					e.Cancel = true;
			}
			catch (PCSException ex)
			{
				// Displays the error message if throwed from PCSException.
				PCSMessageBox.Show(ex.mCode, MessageBoxIcon.Error);
				try
				{
					// Log error message into log file.
					Logger.LogMessage(ex.CauseException, METHOD_NAME, Level.ERROR);
				}
				catch
				{
					// Show message if logger has an error.
					PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxIcon.Error);
				}
			}
			catch (Exception ex)
			{
				// Displays the error message if throwed from system.
				PCSMessageBox.Show(ErrorCode.OTHER_ERROR, MessageBoxIcon.Error);
				try
				{
					// Log error message into log file.
					Logger.LogMessage(ex, METHOD_NAME, Level.ERROR);
				}
				catch
				{
					// Show message if logger has an error.
					PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxIcon.Error);
				}
			}
		}
		
		/// <summary>
		/// Button click to open search form
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void dgrdData_ButtonClick(object sender, C1.Win.C1TrueDBGrid.ColEventArgs e)
		{
			const string METHOD_NAME = THIS + ".dgrdData_ButtonClick()";
			try
			{
				DataRowView drwResult = null;
				Hashtable htbCondition= new Hashtable();
				if (!btnSave.Enabled) return;
				if (dgrdData.Col == dgrdData.Columns.IndexOf(dgrdData.Columns[ITM_ProductTable.CODE_FLD]))
				{
					//open the search form to select Product
					if (cboCCN.SelectedValue != null)
					{
						htbCondition.Add(ITM_ProductTable.CCNID_FLD, cboCCN.SelectedValue.ToString());
					}
					else
					{
						htbCondition.Add(ITM_ProductTable.CCNID_FLD, 0);
					}
					if (dgrdData.AddNewMode == AddNewModeEnum.AddNewCurrent)
					{
						drwResult = FormControlComponents.OpenSearchForm(ITM_ProductTable.TABLE_NAME, ITM_ProductTable.CODE_FLD, dgrdData[dgrdData.Row, ITM_ProductTable.CODE_FLD].ToString(), htbCondition, true);
					}
					else
					{
						drwResult = FormControlComponents.OpenSearchForm(ITM_ProductTable.TABLE_NAME, ITM_ProductTable.CODE_FLD, dgrdData.Columns[ITM_ProductTable.CODE_FLD].Text.Trim(), htbCondition, true);
					}
					if (drwResult != null)
					{
						FillItemData(drwResult.Row);
					}
				}

				if (dgrdData.Col == dgrdData.Columns.IndexOf(dgrdData.Columns[ITM_ProductTable.DESCRIPTION_FLD]))
				{
					//open the search form to select Product
					if (cboCCN.SelectedValue != null)
					{
						htbCondition.Add(ITM_ProductTable.CCNID_FLD, cboCCN.SelectedValue.ToString());
					}
					else
					{
						htbCondition.Add(ITM_ProductTable.CCNID_FLD, 0);
					}
					if (dgrdData.AddNewMode != AddNewModeEnum.NoAddNew)
					{
						drwResult = FormControlComponents.OpenSearchForm(ITM_ProductTable.TABLE_NAME, ITM_ProductTable.DESCRIPTION_FLD, dgrdData[dgrdData.Row, ITM_ProductTable.DESCRIPTION_FLD].ToString(), htbCondition, true);
					}
					else
					{
						drwResult = FormControlComponents.OpenSearchForm(ITM_ProductTable.TABLE_NAME, ITM_ProductTable.DESCRIPTION_FLD, dgrdData.Columns[ITM_ProductTable.DESCRIPTION_FLD].Text.Trim(), htbCondition, true);
					}
					if (drwResult != null)
					{
						FillItemData(drwResult.Row);
					}
				}

				if (dgrdData.Col == dgrdData.Columns.IndexOf(dgrdData.Columns[MST_UnitOfMeasureTable.TABLE_NAME + MST_UnitOfMeasureTable.CODE_FLD]))
				{
					//open the search form to select Unit Of Measure
					if (dgrdData.AddNewMode != AddNewModeEnum.NoAddNew)
					{
						drwResult = FormControlComponents.OpenSearchForm(MST_UnitOfMeasureTable.TABLE_NAME, MST_UnitOfMeasureTable.CODE_FLD, dgrdData[dgrdData.Row, MST_UnitOfMeasureTable.TABLE_NAME + MST_UnitOfMeasureTable.CODE_FLD].ToString(), htbCondition, true);
					}
					else
					{
						drwResult = FormControlComponents.OpenSearchForm(MST_UnitOfMeasureTable.TABLE_NAME, MST_UnitOfMeasureTable.CODE_FLD, dgrdData.Columns[MST_UnitOfMeasureTable.TABLE_NAME + MST_UnitOfMeasureTable.CODE_FLD].Text.Trim(), htbCondition, true);
					}
					if (drwResult != null)
					{
						dgrdData[dgrdData.Row, SO_CustomerItemRefDetailTable.UNITOFMEASUREID_FLD] = drwResult[SO_CustomerItemRefDetailTable.UNITOFMEASUREID_FLD];
						dgrdData[dgrdData.Row, MST_UnitOfMeasureTable.TABLE_NAME + MST_UnitOfMeasureTable.CODE_FLD] = drwResult[MST_UnitOfMeasureTable.CODE_FLD];	
					}
				}
			}
			catch (PCSException ex)
			{
				// Displays the error message if throwed from PCSException.
				PCSMessageBox.Show(ex.mCode, MessageBoxIcon.Error);
				try
				{
					// Log error message into log file.
					Logger.LogMessage(ex.CauseException, METHOD_NAME, Level.ERROR);
				}
				catch
				{
					// Show message if logger has an error.
					PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxIcon.Error);
				}
			}
			catch (Exception ex)
			{
				// Displays the error message if throwed from system.
				PCSMessageBox.Show(ErrorCode.OTHER_ERROR, MessageBoxIcon.Error);
				try
				{
					// Log error message into log file.
					Logger.LogMessage(ex, METHOD_NAME, Level.ERROR);
				}
				catch
				{
					// Show message if logger has an error.
					PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxIcon.Error);
				}
			}
		}

		/// <summary>
		/// - Fill data into item code, item description, item revision, stock unit of measure 
		/// - Fill data into start/due date time based on current server date time
		/// - Fill data into AGC, cost method, estimated cost based on product item setup
		/// </summary>
		private void FillItemData(DataRow pdrowData)
		{
			const string METHOD_NAME = THIS + ".FillItemData()";
			int i = dgrdData.Row;
//			try
//			{
				dgrdData.EditActive = true;
				dgrdData[i, ITM_ProductTable.CODE_FLD] = pdrowData[ITM_ProductTable.CODE_FLD].ToString();
				dgrdData[i, ITM_ProductTable.DESCRIPTION_FLD] = pdrowData[ITM_ProductTable.DESCRIPTION_FLD].ToString();
				dgrdData[i, ITM_ProductTable.REVISION_FLD] = pdrowData[ITM_ProductTable.REVISION_FLD].ToString();
				dgrdData[i, SO_CustomerItemRefDetailTable.PRODUCTID_FLD] = pdrowData[ITM_ProductTable.PRODUCTID_FLD].ToString();
				dgrdData[i, ITM_CategoryTable.TABLE_NAME + ITM_CategoryTable.CODE_FLD] = pdrowData[ITM_ProductTable.CATEGORYID_FLD + "_" + ITM_CategoryTable.CODE_FLD].ToString();
				dgrdData[i, SO_CustomerItemRefDetailTable.UNITOFMEASUREID_FLD] = pdrowData[ITM_ProductTable.SELLINGUMID_FLD].ToString();
				DataRowView drwViewUM = FormControlComponents.OpenSearchForm(MST_UnitOfMeasureTable.TABLE_NAME, MST_UnitOfMeasureTable.UNITOFMEASUREID_FLD, pdrowData[ITM_ProductTable.SELLINGUMID_FLD].ToString(), null, false);
				if (drwViewUM != null)
				{
					dgrdData[i, MST_UnitOfMeasureTable.TABLE_NAME + MST_UnitOfMeasureTable.CODE_FLD] = drwViewUM[MST_UnitOfMeasureTable.CODE_FLD];
				}
				dgrdData.Col = dgrdData.Splits[0].DisplayColumns.IndexOf(dgrdData.Splits[0].DisplayColumns[ITM_ProductTable.CODE_FLD]);
				dgrdData.Focus();
//			}
//			catch (PCSException ex)
//			{
//				throw new PCSException(ex.mCode, METHOD_NAME, ex);
//			}
//			catch (Exception ex)
//			{
//				throw new Exception(ex.Message, ex);
//			}
		}

		private void CustomerAndItemReference_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
		{
			if (e.KeyCode == Keys.F12)
			{
				dgrdData.Row = dgrdData.RowCount - 1;
				dgrdData.Col = dgrdData.Columns.IndexOf(dgrdData.Columns[ITM_ProductTable.CODE_FLD]);
				dgrdData.Focus();
			}
			if (e.KeyCode == Keys.Escape)
			{
				this.Close();
			}
		}
		
		/// <summary>
		/// Open search form & check data
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void dgrdData_BeforeColUpdate(object sender, C1.Win.C1TrueDBGrid.BeforeColUpdateEventArgs e)
		{
			const string METHOD_NAME = THIS + ".dgrdData_BeforeColUpdate()";
			try
			{
				if (e.Column.DataColumn.Value.ToString() == string.Empty) return;
				Hashtable htbCriteria = new Hashtable();
				DataRowView drwResult = null;
				switch (e.Column.DataColumn.DataField)
				{
					case ITM_ProductTable.CODE_FLD:
						# region open Product search form 
						if (cboCCN.SelectedIndex >= 0)
						{
							htbCriteria.Add(MST_CCNTable.CCNID_FLD, cboCCN.SelectedValue.ToString());
						}
						else
						{
							htbCriteria.Add(MST_CCNTable.CCNID_FLD, 0);
						}
						drwResult = FormControlComponents.OpenSearchForm(ITM_ProductTable.TABLE_NAME, ITM_ProductTable.CODE_FLD, dgrdData.Columns[e.Column.DataColumn.DataField].Text.Trim(), htbCriteria, false);
						if (drwResult != null)
						{
							e.Column.DataColumn.Tag = drwResult.Row;
						}
						else
						{
							e.Cancel = true;
						}
						#endregion
						break;
					case ITM_ProductTable.DESCRIPTION_FLD:
						# region open Product search form 
						if (cboCCN.SelectedIndex >= 0)
						{
							htbCriteria.Add(MST_CCNTable.CCNID_FLD, cboCCN.SelectedValue.ToString());
						}
						else
						{
							htbCriteria.Add(MST_CCNTable.CCNID_FLD, 0);
						}
						drwResult = FormControlComponents.OpenSearchForm(ITM_ProductTable.TABLE_NAME, ITM_ProductTable.DESCRIPTION_FLD, dgrdData.Columns[e.Column.DataColumn.DataField].Text.Trim(), htbCriteria, false);
						if (drwResult != null)
						{
							e.Column.DataColumn.Tag = drwResult.Row;
						}
						else
						{
							e.Cancel = true;
						}
						#endregion
						break;
					case MST_UnitOfMeasureTable.TABLE_NAME + MST_UnitOfMeasureTable.CODE_FLD:
						#region open Unit form
						drwResult = FormControlComponents.OpenSearchForm(MST_UnitOfMeasureTable.TABLE_NAME, MST_UnitOfMeasureTable.CODE_FLD, dgrdData.Columns[MST_UnitOfMeasureTable.TABLE_NAME + MST_UnitOfMeasureTable.CODE_FLD].Text.Trim(), htbCriteria, false);
						if (drwResult != null)
						{
							e.Column.DataColumn.Tag = drwResult.Row;
						}
						else e.Cancel = true;
						#endregion
						break;
				}

				//check lead time offset
				if (e.Column.DataColumn.DataField == SO_CustomerItemRefDetailTable.UNITPRICE_FLD)
				{
					try
					{
						if (e.Column.DataColumn.Value.ToString() != string.Empty)
						{
							decimal intUnitPrice = decimal.Parse(e.Column.DataColumn.Value.ToString());
							if (intUnitPrice <= 0)
							{
								PCSMessageBox.Show(ErrorCode.MESSAGE_CANNOT_INPUT_NEGATIVE_NUMBER, MessageBoxIcon.Error);
								e.Cancel = true;
							}
						}
					}
					catch (Exception ex)
					{
						PCSMessageBox.Show(ErrorCode.MESSAGE_CANNOT_INPUT_NEGATIVE_NUMBER, MessageBoxIcon.Error);
						e.Cancel = true;
					}
				}
			}
			catch (PCSException ex)
			{
				// Displays the error message if throwed from PCSException.
				PCSMessageBox.Show(ex.mCode, MessageBoxIcon.Error);
				try
				{
					// Log error message into log file.
					Logger.LogMessage(ex.CauseException, METHOD_NAME, Level.ERROR);
				}
				catch
				{
					// Show message if logger has an error.
					PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxIcon.Error);
				}
			}
			catch (Exception ex)
			{
				// Displays the error message if throwed from system.
				PCSMessageBox.Show(ErrorCode.OTHER_ERROR, MessageBoxIcon.Error);
				try
				{
					// Log error message into log file.
					Logger.LogMessage(ex, METHOD_NAME, Level.ERROR);
				}
				catch
				{
					// Show message if logger has an error.
					PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxIcon.Error);
				}
			}
		}
		
		/// <summary>
		/// Commit data into grid
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void dgrdData_AfterColUpdate(object sender, C1.Win.C1TrueDBGrid.ColEventArgs e)
		{
			const string METHOD_NAME = THIS + ".dgrdData_AfterColUpdate()";
			try
			{
				if (e.Column.DataColumn.DataField == ITM_ProductTable.CODE_FLD || e.Column.DataColumn.DataField == ITM_ProductTable.DESCRIPTION_FLD)
				{
					if ((e.Column.DataColumn.Tag == null) ||(e.Column.DataColumn.Text.Trim() == string.Empty))
					{
						dgrdData[dgrdData.Row, ITM_ProductTable.CODE_FLD] = string.Empty;
						dgrdData[dgrdData.Row, ITM_ProductTable.DESCRIPTION_FLD] = string.Empty;
						dgrdData[dgrdData.Row, ITM_ProductTable.REVISION_FLD] = string.Empty;
						dgrdData[dgrdData.Row, ITM_ProductTable.PRODUCTID_FLD] = DBNull.Value;
						dgrdData[dgrdData.Row, SO_CustomerItemRefDetailTable.UNITOFMEASUREID_FLD] = DBNull.Value;
						dgrdData[dgrdData.Row, MST_UnitOfMeasureTable.TABLE_NAME + MST_UnitOfMeasureTable.CODE_FLD] = DBNull.Value;
					}
					else
					{
						FillItemData((DataRow) e.Column.DataColumn.Tag);
						return;
					}
				}
				if (e.Column.DataColumn.DataField == MST_UnitOfMeasureTable.TABLE_NAME + MST_UnitOfMeasureTable.CODE_FLD)
				{
					if ((e.Column.DataColumn.Tag == null) ||(e.Column.DataColumn.Text.Trim() == string.Empty))
					{
						dgrdData[dgrdData.Row, SO_CustomerItemRefDetailTable.UNITOFMEASUREID_FLD] = DBNull.Value;
						dgrdData[dgrdData.Row, MST_UnitOfMeasureTable.TABLE_NAME + MST_UnitOfMeasureTable.CODE_FLD] = DBNull.Value;
					}
					else
					{
						dgrdData[dgrdData.Row, SO_CustomerItemRefDetailTable.UNITOFMEASUREID_FLD] = ((DataRow) e.Column.DataColumn.Tag)[MST_UnitOfMeasureTable.UNITOFMEASUREID_FLD];
					}
				}
			}
			catch (PCSException ex)
			{
				// Displays the error message if throwed from PCSException.
				PCSMessageBox.Show(ex.mCode, MessageBoxIcon.Error);
				try
				{
					// Log error message into log file.
					Logger.LogMessage(ex.CauseException, METHOD_NAME, Level.ERROR);
				}
				catch
				{
					// Show message if logger has an error.
					PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxIcon.Error);
				}
			}
			catch (Exception ex)
			{
				// Displays the error message if throwed from system.
				PCSMessageBox.Show(ErrorCode.OTHER_ERROR, MessageBoxIcon.Error);
				try
				{
					// Log error message into log file.
					Logger.LogMessage(ex, METHOD_NAME, Level.ERROR);
				}
				catch
				{
					// Show message if logger has an error.
					PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxIcon.Error);
				}
			}
		}

		/// <summary>
		/// Keydown event
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void dgrdData_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
		{
			switch (e.KeyCode)
			{
				case Keys.F4:
					if (btnSave.Enabled)
					{
						dgrdData_ButtonClick(sender, null);
					}
					break;
				case Keys.Delete:
					FormControlComponents.DeleteMultiRowsOnTrueDBGrid(dgrdData);
					break;
			}
		}

		/// <summary>
		/// Validate all data, and some business rules
		/// </summary>
		/// <returns></returns>
		private bool ValidateData()
		{
			const string METHOD_NAME = THIS + ".ValidateData()";
			try
			{
				if(txtCustomer.Text.Trim() == string.Empty)
				{
					PCSMessageBox.Show(ErrorCode.MANDATORY_INVALID,MessageBoxIcon.Exclamation);
					txtCustomer.Focus();
					return false;
				}
				//check madatory field in grid
				for (int i = 0; i < dgrdData.RowCount - 1; i++)
				{
					if (dgrdData[i, ITM_ProductTable.CODE_FLD].ToString().Trim() == string.Empty)
					{
						PCSMessageBox.Show(ErrorCode.MANDATORY_INVALID, MessageBoxIcon.Error);
						dgrdData.Row = i;
						dgrdData.Col = dgrdData.Splits[0].DisplayColumns.IndexOf(dgrdData.Splits[0].DisplayColumns[ITM_ProductTable.CODE_FLD]);
						dgrdData.Focus();
						return false;
					}
					if (dgrdData[i, MST_UnitOfMeasureTable.TABLE_NAME + MST_UnitOfMeasureTable.CODE_FLD].ToString().Trim() == string.Empty)
					{
						PCSMessageBox.Show(ErrorCode.MANDATORY_INVALID, MessageBoxIcon.Error);
						dgrdData.Row = i;
						dgrdData.Col = dgrdData.Splits[0].DisplayColumns.IndexOf(dgrdData.Splits[0].DisplayColumns[MST_UnitOfMeasureTable.TABLE_NAME + MST_UnitOfMeasureTable.CODE_FLD]);
						dgrdData.Focus();
						return false;
					}
					if (dgrdData[i, SO_CustomerItemRefDetailTable.UNITPRICE_FLD].ToString().Trim() == string.Empty)
					{
						PCSMessageBox.Show(ErrorCode.MANDATORY_INVALID, MessageBoxIcon.Error);
						dgrdData.Row = i;
						dgrdData.Col = dgrdData.Splits[0].DisplayColumns.IndexOf(dgrdData.Splits[0].DisplayColumns[SO_CustomerItemRefDetailTable.UNITPRICE_FLD]);
						dgrdData.Focus();
						return false;
					}
					if (dgrdData[i, SO_CustomerItemRefDetailTable.CUSTOMERITEMCODE_FLD].ToString() == string.Empty)
					{
						PCSMessageBox.Show(ErrorCode.MANDATORY_INVALID, MessageBoxIcon.Error);
						dgrdData.Row = i;
						dgrdData.Col = dgrdData.Splits[0].DisplayColumns.IndexOf(dgrdData.Splits[0].DisplayColumns[SO_CustomerItemRefDetailTable.CUSTOMERITEMCODE_FLD]);
						dgrdData.Focus();
						return false;
					}
				}

				for (int i =0; i <dgrdData.RowCount; i++)
				{
					for (int j =i+1; j <dgrdData.RowCount; j++)
					{
						if (dgrdData[i, SO_CustomerItemRefDetailTable.PRODUCTID_FLD].ToString() == dgrdData[j, SO_CustomerItemRefDetailTable.PRODUCTID_FLD].ToString())
						{
							PCSMessageBox.Show(ErrorCode.DUPLICATE_KEY, MessageBoxIcon.Error);
							dgrdData.Row = i;
							dgrdData.Col = dgrdData.Splits[0].DisplayColumns.IndexOf(dgrdData.Splits[0].DisplayColumns[ITM_ProductTable.CODE_FLD]);
							dgrdData.Focus();
							return false;
						}

						if (dgrdData[i, SO_CustomerItemRefDetailTable.CUSTOMERITEMCODE_FLD].ToString() == dgrdData[j, SO_CustomerItemRefDetailTable.CUSTOMERITEMCODE_FLD].ToString()
							&& dgrdData[i, SO_CustomerItemRefDetailTable.CUSTOMERITEMMODEL_FLD].ToString() == dgrdData[j, SO_CustomerItemRefDetailTable.CUSTOMERITEMMODEL_FLD].ToString())
						{
							PCSMessageBox.Show(ErrorCode.DUPLICATE_KEY, MessageBoxIcon.Error);
							dgrdData.Row = i;
							dgrdData.Col = dgrdData.Splits[0].DisplayColumns.IndexOf(dgrdData.Splits[0].DisplayColumns[SO_CustomerItemRefDetailTable.CUSTOMERITEMCODE_FLD]);
							dgrdData.Focus();
							return false;
						}
					}
				}
			}
			catch (PCSException ex)
			{
				throw new PCSException(ex.mCode, METHOD_NAME, ex);
			}
			catch (Exception ex)
			{
				throw new Exception(ex.Message, ex);
			}
			return true;
		}
		
		/// <summary>
		/// Save event
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void btnSave_Click(object sender, System.EventArgs e)
		{
			const string METHOD_NAME = THIS + ".btnSave_Click()";
			try
			{
				blnHasError = true;
				if (!dgrdData.EditActive && ValidateData() && btnSave.Enabled)
				{
					boCustomerAndItem.UpdateMasterAndDetail(voCustomMaster, dstData);
					PCSMessageBox.Show(ErrorCode.MESSAGE_AFTER_SAVE_DATA);

					//Reload
					BindDataToGrid(int.Parse(txtCustomer.Tag.ToString()), int.Parse(cboCCN.SelectedValue.ToString()));
					blnHasError = false;
					txtCustomer.Focus();
				}
			}
			catch (PCSException ex)
			{
				// Displays the error message if throwed from PCSException.
				PCSMessageBox.Show(ex.mCode, MessageBoxIcon.Error);
				try
				{
					// Log error message into log file.
					Logger.LogMessage(ex.CauseException, METHOD_NAME, Level.ERROR);
				}
				catch
				{
					// Show message if logger has an error.
					PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxIcon.Error);
				}
			}
			catch (Exception ex)
			{
				// Displays the error message if throwed from system.
				PCSMessageBox.Show(ErrorCode.OTHER_ERROR, MessageBoxIcon.Error);
				try
				{
					// Log error message into log file.
					Logger.LogMessage(ex, METHOD_NAME, Level.ERROR);
				}
				catch
				{
					// Show message if logger has an error.
					PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxIcon.Error);
				}
			}
		}

		private void btnDelete_Click(object sender, System.EventArgs e)
		{
			const string METHOD_NAME = THIS + ".AutoFillItemReference()";
			try
			{
				if (btnDelete.Enabled && !dgrdData.EditActive && PCSMessageBox.Show(ErrorCode.MESSAGE_DELETE_RECORD, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
				{
					boCustomerAndItem.DeleteMasterAndDetail(voCustomMaster);

					txtCustomer.Text = string.Empty;
					txtCustomer.Tag = null;
					txtCustomerName.Text = string.Empty;
					BindDataToGrid(0, 0);
					btnSave.Enabled = false;
					btnDelete.Enabled = false;
					txtCustomer.Focus();
				}
			}
			catch (PCSException ex)
			{
				// Displays the error message if throwed from PCSException.
				PCSMessageBox.Show(ex.mCode, MessageBoxIcon.Error);
				try
				{
					// Log error message into log file.
					Logger.LogMessage(ex.CauseException, METHOD_NAME, Level.ERROR);
				}
				catch
				{
					// Show message if logger has an error.
					PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxIcon.Error);
				}
			}
			catch (Exception ex)
			{
				// Displays the error message if throwed from system.
				PCSMessageBox.Show(ErrorCode.OTHER_ERROR, MessageBoxIcon.Error);
				try
				{
					// Log error message into log file.
					Logger.LogMessage(ex, METHOD_NAME, Level.ERROR);
				}
				catch
				{
					// Show message if logger has an error.
					PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxIcon.Error);
				}
			}
		}

		private void txtCustomer_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
		{
			if (e.KeyCode == Keys.F4)
			{
				btnCustomerSearch_Click(sender, new EventArgs());
			}
		}

		private void txtCustomerName_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
		{
			if (e.KeyCode == Keys.F4)
			{
				btnCustomerNameSearch_Click(sender, new EventArgs());
			}
		}

		private void CustomerAndItemReference_Closing(object sender, System.ComponentModel.CancelEventArgs e)
		{
			const string METHOD_NAME = THIS + ".AutoFillItemReference()";
			try
			{
				if (dstData != null && dstData.GetChanges() != null)
				{
					DialogResult confirmDialog = PCSMessageBox.Show(ErrorCode.MESSAGE_QUESTION_STORE_INTO_DATABASE, MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
					switch (confirmDialog)
					{
						case DialogResult.Yes:
							//Save before exit
							btnSave_Click(btnSave, new EventArgs());
							if (blnHasError)
							{
								e.Cancel = true;
							}
							break;
						case DialogResult.No:
							break;
						case DialogResult.Cancel:
							e.Cancel = true;
							break;
					}
				}
			}
			catch (PCSException ex)
			{
				// Displays the error message if throwed from PCSException.
				PCSMessageBox.Show(ex.mCode, MessageBoxIcon.Error);
				try
				{
					// Log error message into log file.
					Logger.LogMessage(ex.CauseException, METHOD_NAME, Level.ERROR);
				}
				catch
				{
					// Show message if logger has an error.
					PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxIcon.Error);
				}
			}
			catch (Exception ex)
			{
				// Displays the error message if throwed from system.
				PCSMessageBox.Show(ErrorCode.OTHER_ERROR, MessageBoxIcon.Error);
				try
				{
					// Log error message into log file.
					Logger.LogMessage(ex, METHOD_NAME, Level.ERROR);
				}
				catch
				{
					// Show message if logger has an error.
					PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxIcon.Error);
				}
			}
		}

		private void dgrdData_BeforeColEdit(object sender, C1.Win.C1TrueDBGrid.BeforeColEditEventArgs e)
		{
			if (txtCustomer.Text.Trim() == string.Empty)
			{
				e.Cancel = true;
			}
		}
	}
}
